<?php

use Illuminate\Http\Request;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

Route::get('/user', function (Request $request) {
    return $request->user();
})->middleware('auth:api');


$api = app('Dingo\Api\Routing\Router');
$api->version('v1', function ($api){
    $api->group(['namespace'=>'App\Http\Controllers'], function ($api){
        $api->get('/redis/set', 'ApplicationController@set');
        $api->get('/redis/delete', 'ApplicationController@delete');
        $api->get('/redis/get', 'ApplicationController@get');
        $api->get('/testsms', 'SmsController@testsms');
        $api->post('post', 'ApplicationController@get_post');
        $api->post('login','AuthController@authenticate');
        $api->get('colleagues', 'SiteController@colleagueIndex');
        $api->get('projects', 'SiteController@projectIndex');
        $api->get('projects/{id}', 'SiteController@show');
        $api->post('application', 'ApplicationController@create');
        $api->group(['middleware' => 'jwt.api.auth'], function ($api) {
            $api->post('register', 'AuthController@register');
            $api->post('/projects/{id}/update', 'SiteController@update');
            $api->delete('/projects/{id}', 'SiteController@destroy');
            $api->post('/projects/create', 'SiteController@store');
        });
    });
});